package cn.calm.swing.osgi.api;

public abstract class DefaultMenuService implements MenuService,Comparable<MenuService> {
	private MenuService parent;

	@Override
	public void setParent(MenuService parent) {
		this.parent = parent;
	}

	@Override
	public MenuService getParent() {
		return parent;
	}
	@Override
	public int compareTo(MenuService o) {
		if(getIndex()==o.getIndex()){
			return getMenu().getText().compareTo(o.getMenu().getText());
		}else{
			return o.getIndex()-getIndex();
		}
//		final int prime = 31;
//		int result = 1;
//		result = prime * result + getIndex();
//		result = prime * result + ((getMenu() == null) ? 0 : getMenu().hashCode());
//		return result;
	}
}
